﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ResourcesFont.cs" company="Jarno Burger">
//   See copyright.txt in the root of this project.
// </copyright>
// <summary>
//   Defines the ResourcesFont type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace WinFormAdapter.Resources
{
    using System.Drawing;

    using GUI4UFramework.Management;

    /// <summary>
    /// The resource pool containing the fonts.
    /// </summary>
    public class ResourcesFont : ResourcePool<Font>
    {
        /// <summary>
        /// Creates a font using specifed font name.
        /// </summary>
        /// <param name="fontName">Name of the font.</param>
        /// <returns>The resource location name , that is the same as the font name.</returns>
        public string CreateFromFontName(string fontName)
        {
            if (Resources.ContainsKey(fontName))
            {
                return fontName;
            }

            var font = new Font(fontName, 10);

            Resources.Add(fontName, font);

            return fontName;
        }

        /// <summary>
        /// Debugs this instance. Let this class spit out debug info.
        /// </summary>
        public override void Debug()
        {
            System.Diagnostics.Debug.WriteLine("Library for SpriteFonts contains : ");
            foreach (var resource in this.Resources)
            {
                var value = resource.Value;
                System.Diagnostics.Debug.WriteLine("[" + resource.Key + "] : " + value);
            }
        }
    }
}
